package com.fulu.game.bi.service.impl.room;

import com.fulu.game.bi.entity.vo.common.CodeNameVO;
import com.fulu.game.bi.mysql.playadmin.room.GuildInfoDao;
import com.fulu.game.bi.mysql.playadmin.room.RoomCategoryDao;
import com.fulu.game.bi.mysql.playadmin.room.RoomDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class RoomConditionService {

    @Autowired
    private RoomCategoryDao roomCategoryDao;
    @Autowired
    private RoomDao roomDao;
    @Autowired
    private GuildInfoDao guildInfoDao;

    public List<CodeNameVO> roomCategory() {
        return roomCategoryDao.findByPid(1);
    }


    public PageInfo<CodeNameVO> roomNo(Integer pageNum, Integer pageSize, String roomNo) {
        PageHelper.startPage(pageNum, pageSize, "id desc");
        List<CodeNameVO> list = roomDao.queryRoomNo(roomNo);
        return new PageInfo(list);
    }

    public PageInfo<CodeNameVO> guildCode(Integer pageNum, Integer pageSize, String guildCode) {
        PageHelper.startPage(pageNum, pageSize, "id desc");
        List<CodeNameVO> list = guildInfoDao.guildCode(guildCode);
        return new PageInfo(list);
    }
}
